CC = gcc
CFLAGS = -O0

SRCDIR = src
DISTDIR = dist
TESTDIR = tests
MYNAME = tp1
MAINFILE = $(SRCDIR)/main.c
ASSEMBLEFILES = $(SRCDIR)/pop.S $(SRCDIR)/push.S $(SRCDIR)/sumarTodosLosElementos.S
POPTEST = $(TESTDIR)/test-pop.c
PUSHTEST = $(TESTDIR)/test-push.c
ADDTEST = $(TESTDIR)/test-suma.c
FULLTEST = $(TESTDIR)/test-full.c

tp1: $(DISTDIR)
	$(CC) $(CFLAGS) $(MAINFILE) $(ASSEMBLEFILES) -o $(DISTDIR)/$(MYNAME)

test: tests
tests: addtest

addtest: poptest
	$(CC) $(CFLAGS) $(ADDTEST) $(ASSEMBLEFILES) -o $(DISTDIR)/test-suma

poptest: pushtest
	$(CC) $(CFLAGS) $(POPTEST) $(ASSEMBLEFILES) -o $(DISTDIR)/test-pop

pushtest: fulltest
	$(CC) $(CFLAGS) $(PUSHTEST) $(ASSEMBLEFILES) -o $(DISTDIR)/test-push

fulltest: tp1 
	$(CC) $(CFLAGS) $(FULLTEST) $(ASSEMBLEFILES) -o $(DISTDIR)/test-full

$(DISTDIR):
	mkdir $(DISTDIR)

clean:
	rm -fr $(DISTDIR)


